package com.csce.domain.entity.exam;

import com.csce.domain.entity.exam.vo.Checked;
import com.csce.domain.entity.exam.vo.ExExamQuestion;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.osce.common.annotation.Excel;
import com.osce.common.core.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.validation.constraints.NotBlank;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 理论练习对象 ex_exercise
 *
 * @author zzx
 * @since 2023-08-02
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
@Builder
@ToString
@EqualsAndHashCode(callSuper = true)
public class ExExercise extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    private Long id;

    /**
     * 用户编号
     */
    @Excel(name = "用户编号")
    @ApiModelProperty("用户编号")
    private Long userId;

    /**
     * 名称
     */
    @Excel(name = "名称")
    @ApiModelProperty("名称")
    @NotBlank(message = "名称不可为空")
    private String name;

    /**
     * 总题数
     */
    @Excel(name = "总题数")
    @ApiModelProperty("总题数")
    private Integer questionCount;

    /**
     * 对题书
     */
    @Excel(name = "对题书")
    @ApiModelProperty("对题书")
    private Integer rightCount;

    /**
     * 得分
     */
    @Excel(name = "得分")
    @ApiModelProperty("得分")
    private Double score;

    /**
     * 答题用时
     */
    @Excel(name = "答题用时")
    @ApiModelProperty("答题用时")
    private Integer answerTime;

    /**
     * 开始时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
    @ApiModelProperty("开始时间")
    private Date startTime;

    /**
     * 结束时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
    @ApiModelProperty("结束时间")
    private Date endTime;

    /**
     * 状态
     */
    @Excel(name = "状态")
    @ApiModelProperty("状态")
    private Integer status;

    /**
     * 预留字段2
     */
    @ApiModelProperty("状态")
    private String reservedOne;

    /**
     * 预留字段2
     */
    @ApiModelProperty("状态")
    private String reservedTwo;

    /**
     * 策略
     */
    @NotBlank(message = "请输入策略")
    private String sig;

    /**
     * 选中题库
     */
    private List<Checked> checkeds;

    private Collection<Long> questionIds;

    private Map<Long, ExExamQuestion> examQuestions;

    public ExExercise setExamQuestions(Map<Long, ExExamQuestion> examQuestions) {
        this.examQuestions = examQuestions;
        return this;
    }

    public ExExercise setQuestionIds(Collection<Long> questionIds) {
        this.questionIds = questionIds;
        return this;
    }
}
